using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ToastCtrl : MonoBehaviour
{
    private const string TriggleShow = "show";
    private const string TriggleHide = "hide";


    private Animator animator;

    // Start is called before the first frame update
    void Start()
    {
        animator = GetComponent<Animator>();
    }


    // Update is called once per frame
    void Update()
    {
        
    }

    public void ShowToast() {
        Debug.Log("ShowToast called!");
        animator.SetTrigger(TriggleShow);
        StartCoroutine(Co_AutoHide());
    }

    IEnumerator Co_AutoHide()
    {
        yield return new WaitForSeconds(2.0f);
        Hide();
    }

    void Hide() {
        animator.SetTrigger(TriggleHide);
    }
}
